import requests
import json




# 获取f

def get_f(imgbase64):
    url = 'http://192.168.1.40:5000/getbigf'
    data = {
        'base64': imgbase64
    }
    try:
        r = requests.post(url, json.dumps(data))
        # print(r.text)

        res = json.loads(r.text)
        return res['f']
    except:
        return None



def get_ovo_sim(a_base64_f, b_base64_f):
    url = 'http://192.168.1.40:5000/faceoof'
    data = {
        "a": a_base64_f,
        "b": b_base64_f
    }
    try:
        r = requests.post(url, json.dumps(data))
        # print(r.text)

        res = json.loads(r.text)
        return res['similarity']
    except:
        return -1